#include<iostream>
#include<string>
#include<set>
#include<algorithm>
using namespace std;

bool compare(char a, char b)
{
    return a > b;
}

int main()
{
    string s, ret;
    cin >> s;
    set<char> str;
    for (char c : s)
    {
        if (str.find(c) == str.end())
        {
            str.insert(c);
            ret += c;
        }
    }

    sort(ret.begin(), ret.end(), compare);
    cout << "int[] arr = new int[]{";
    for (int i = 0; i < ret.size(); i++)
    {
        if (i != ret.size() - 1)
            cout << ret[i] << ',';
        else
            cout << ret[i] << "};";
    }
    cout << endl;
    cout << "int[] index = new int[]{";
    for (int i = 0; i < s.size(); i++)
    {
        for (int j = 0; j < ret.size(); j++)
        {
            if (s[i] == ret[j] && i != s.size() - 1)
            {
                cout << j  << ',';
                break;
            }
            else if (i == s.size() - 1 && s[i] == ret[j] )
            {
                cout << j ;
                break;
            }
            else
            {
                ;
            }
        }
    }
    cout << "};" << endl;
    return 0;
}